<%-- 
    Document   : MostrarNutriologos_json
    Created on : 07-sep-2014, 16:32:42
    Author     : Administrador
--%>

<%@page import="java.sql.ResultSet"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <jsp:useBean id="base" class="metodo.metodosadmin" scope="page"></jsp:useBean>
        <title>JSP Page</title>
    <%
        String nim = request.getParameter("serie");
        try{
            ResultSet rs=base.Nutriologos("%"+nim+"%");
            
            //Si no hay un siguiente
            if(!rs.next()){
                out.print("No se encontraron Nutriologos registrados");
            }
            else{
         out.print("[");
        %>
        
            <%
                do{
                out.print("{");
                   out.print("'\"rfc\":"+rs.getString(1)+",");
                   out.print("\"cedula\":\""+rs.getString(2)+"\",");
                   out.print("\"usuario\":\""+rs.getString(3)+"\",");
                   out.print("\"apellidos\":\""+rs.getString(4)+"\",");
                   out.print("\"direccion\":\""+rs.getString(5)+"\",");
                   out.print("\"correo\":\""+rs.getString(6)+"\",");
                   out.print("\"sexo\":\""+rs.getString(7)+"\",");
                   out.print("\"idUsuario\":\""+rs.getString(8)+"\"");
                   if(rs.isLast()){
                   out.print("}");
                   }else{
                       out.print("},");
                   }
            %>
            
            <%
                }
                while(rs.next()); //mientras siga existiendo un registro mas
                out.print("]");
            }
        }
        catch(Exception e){
            out.print("Error al consultar: "+ e);
        }
            %>
    